package com.deng.test.entity;


import java.io.Serializable;

/**
 * @author Dengxiaobing
 * @version 1.0
 * @description
 * @date 2022/9/8 18:07
 */
public class ResultVo<T> implements Serializable {
    private final int code;
    private final String msg;
    private final T data;

    public ResultVo(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public ResultVo(T data) {
        this.code = ResultCode.SUCCESS.getCode();
        this.msg = ResultCode.SUCCESS.getMsg();
        this.data = data;
    }

    public ResultVo(ResultCode rc, T data) {
        this.data = data;
        this.code = rc.getCode();
        this.msg = rc.getMsg();
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public T getData() {
        return data;
    }
}

